package org.esky.mail;

import java.util.Properties;

/**
 * @author Jack.Xu
 * @ClassName: 发送邮件需要使用的邮件的服务器信息
 * @Description: TODO
 * @author: Jack.Xu
 * @date: 2013年10月15日 下午4:09:48
 */
public class MailSenderServerInfo {
	// 发送邮件的服务器的传输协议
	private String mailServerProtocol = "smtp";
	// 发送邮件的服务器的IP
	private String mailServerHost;
	// 发送邮件的服务器的端口
	private String mailServerPort = "25";
	// 登陆邮件发送服务器的用户名和密码
	private String userName;
	private String password;
	// 是否需要身份验证
	private boolean validate = false;

	/**
	 * 获得邮件会话属性
	 */
	public Properties getProperties() {
		Properties p = new Properties();
		p.put("mail.transport.protocol", this.mailServerProtocol);
		p.put("mail.smtp.host", this.mailServerHost);
		p.put("mail.smtp.port", this.mailServerPort);
		p.put("mail.smtp.auth", validate ? "true" : "false");
		return p;
	}
	
	public String getMailServerProtocol() {
		return mailServerProtocol;
	}

	public void setMailServerProtocol(String mailServerProtocol) {
		this.mailServerProtocol = mailServerProtocol;
	}

	public String getMailServerHost() {
		return mailServerHost;
	}

	public void setMailServerHost(String mailServerHost) {
		this.mailServerHost = mailServerHost;
	}

	public String getMailServerPort() {
		return mailServerPort;
	}

	public void setMailServerPort(String mailServerPort) {
		this.mailServerPort = mailServerPort;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isValidate() {
		return validate;
	}

	public void setValidate(boolean validate) {
		this.validate = validate;
	}
}
